//
//  MainViewController.swift
//  Beadhouse
//
//  Created by Apple on 2018/10/24.
//  Copyright © 2018年 wangdong. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.white
        addChild(HomeViewController(), title: "首页", imageName: "me")
        addChild(FoundViewController(), title: "发现", imageName: "me")
        addChild(MessageController(), title: "消息", imageName: "me")
        addChild(MeViewController(), title: "我的", imageName: "me")
    }
    private func addChild(_ childController: UIViewController,title:String,imageName:String) {
        
        childController.title = title
        childController.tabBarItem.image = UIImage(named: imageName)
        childController.tabBarItem.selectedImage = UIImage(named: imageName + "_highlighted")
        let childNav = UINavigationController(rootViewController: childController)
        addChild(childNav)
    }

   
}
